UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7kbOcu3vvdnhwyckDtkIjrIfXfPEe5IHA6moUPWscRw='
WHERE
key_id = '54c489c04603bada6a99ec237c98bee631344b3af3e74f3e18635c0a519b16da'
AND (
token = '7kbOcu3vvdnhwyckDtkIjrIfXfPEe5IHA6moUPWscRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)