UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rMxEldPn1wYlqZerSLlC7fo76Apb+1vx3VFa+35J0vw='
WHERE
key_id = 'fd24eb6ac6aaf749083f54ff998cefe271393c9e69369b3d8a838768db4ae9ce'
AND (
token = 'rMxEldPn1wYlqZerSLlC7fo76Apb+1vx3VFa+35J0vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)