UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ShNkd1GRvij6TJ2g0CONTNH/bqq8lGTIPYJotmkdZr8='
WHERE
key_id = '19486c4b54ddbe641126f160051f8adc841bbabd7d21bc2be856dc4a922aa2ad'
AND (
token = 'ShNkd1GRvij6TJ2g0CONTNH/bqq8lGTIPYJotmkdZr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)