UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JySeXWyhTT44QPL9rGgji55VJ6e263EoZj1QV2Ju8Hs='
WHERE
key_id = 'b1cdb140a4793e1c390023b1bc8ee3b649973fa9868b8fb213e3bb4bcaa0e2d6'
AND (
token = 'JySeXWyhTT44QPL9rGgji55VJ6e263EoZj1QV2Ju8Hs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)