UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eUUfv1iE4Rr3wIsrqgBf53GNealZG3LMJZJXaX14dFo='
WHERE
key_id = '9b14c51d9deed4e85ae984c7dbe59cbbcd7010c091e7393c5334ccc235fb4d64'
AND (
token = 'eUUfv1iE4Rr3wIsrqgBf53GNealZG3LMJZJXaX14dFo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)