UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd/r9LTLOyujC/sdjvmmD5ojiHW5y2XLUeYeCUViHLAI='
WHERE
key_id = '1644ef5e6795dbdc01813cc12c2181b0140350e8942ac2f8313f4e90cff20c11'
AND (
token = 'd/r9LTLOyujC/sdjvmmD5ojiHW5y2XLUeYeCUViHLAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)