UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aR4vVaR9iINA7kuHHzwL64Z96RrC8eahf3dZcBHqzxI='
WHERE
key_id = '52573e1edf6b524d4d2caaf00aff4296fda5ed185241e3ed73cb359b04b334aa'
AND (
token = 'aR4vVaR9iINA7kuHHzwL64Z96RrC8eahf3dZcBHqzxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)