UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f5pP7VJj4Y+lB+GH+2eeircXA8YWmrOdudQX/ym2LoM='
WHERE
key_id = 'ba4780c64835ba2dfee06853c48db31c5039d9203a1f583a92e7bfd3eb5a5050'
AND (
token = 'f5pP7VJj4Y+lB+GH+2eeircXA8YWmrOdudQX/ym2LoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)