UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fzMukHaD3ynFR29r6KQeDhcc9d7ZwWlV5TWVxkV95xM='
WHERE
key_id = '0388972f717c5137a0432ccdcb71c407604851b764ac8fec92cd7ba2f084fe0d'
AND (
token = 'fzMukHaD3ynFR29r6KQeDhcc9d7ZwWlV5TWVxkV95xM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)