UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '49lvjQvOyROBb2e0unEGui6Wtzthlvrivu4/GP3bu1I='
WHERE
key_id = 'b284417df20682052dad9d7cfc7ab337e5795b751c46ecc5e5414c77f94a18bc'
AND (
token = '49lvjQvOyROBb2e0unEGui6Wtzthlvrivu4/GP3bu1I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)