UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZiRi6Ck9rs6c4GWPlXbpcpIypchS1QAH6Kz7ffRR+Io='
WHERE
key_id = '3557fb346c9c1381f5a02c144713695f9539ac743c5c28a4352a643400bbcbd1'
AND (
token = 'ZiRi6Ck9rs6c4GWPlXbpcpIypchS1QAH6Kz7ffRR+Io='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)