UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9v8KXpxKZNo/QxKThcb5pCvriRaiLnDEGE2BwSfNUOo='
WHERE
key_id = 'ba2319448472ca773e7950d16300f656e404402da05776e008b2b77fce780478'
AND (
token = '9v8KXpxKZNo/QxKThcb5pCvriRaiLnDEGE2BwSfNUOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)