UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SkLj/7BMXPwqOznTc14ss+vMjiCoUu+SPvvFzAiXH24='
WHERE
key_id = 'ba5604fe6c8215b83e8e06f53cfb98d9095acafa668a69c382a2b21d4e7437f4'
AND (
token = 'SkLj/7BMXPwqOznTc14ss+vMjiCoUu+SPvvFzAiXH24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)