UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AtgVVDpKVj1i8LM/Rq+ghXxFJHx9/Ro+BHLUKjvWJA8='
WHERE
key_id = 'b0c5ce01a4f60b46411f975dc0338956b4ed733cafade5a9816542344194b996'
AND (
token = 'AtgVVDpKVj1i8LM/Rq+ghXxFJHx9/Ro+BHLUKjvWJA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)