UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qj2OvXQdrQABVBqPrZxki7ExZE/EmCC3Mt9HMuH1VYM='
WHERE
key_id = '1c5a42893784e64464be2e889d8f3ffa1942aa1a731171dd398f030d4b0aa3fa'
AND (
token = 'Qj2OvXQdrQABVBqPrZxki7ExZE/EmCC3Mt9HMuH1VYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)