UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bBb+rFnpNOUKYF4LUN5a8K6wts51THtiPc++hZZUfX0='
WHERE
key_id = '4687cf6fa718b03156a96ad352cbd846f80040d57b4ff322271e16cde5b598ff'
AND (
token = 'bBb+rFnpNOUKYF4LUN5a8K6wts51THtiPc++hZZUfX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)