UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gWXKhqn1ZcKpUDPA7TgFOk+F+EByM+xvGV3Jn5WdARo='
WHERE
key_id = 'f5a60f8fccda74f9d2885695681dff07adb5f11126f9da33750acd00618c40ec'
AND (
token = 'gWXKhqn1ZcKpUDPA7TgFOk+F+EByM+xvGV3Jn5WdARo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)