UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p3yKISU0pqRLUh2icS48cX6YV6f+SiJ20HNiMRfLA6k='
WHERE
key_id = '4588fb194480a66b32926c5daf074cd553e46cdae48479dc86734a28f50d5a3e'
AND (
token = 'p3yKISU0pqRLUh2icS48cX6YV6f+SiJ20HNiMRfLA6k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)