UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYGERgMKNRRH63DuUuGqoRIj33Y/eCGE2mGnqg7ndeA='
WHERE
key_id = '265f2bcf740fc6eff03d12962584fd0a8f0356baaf39699dc692c76e86b8026a'
AND (
token = 'xYGERgMKNRRH63DuUuGqoRIj33Y/eCGE2mGnqg7ndeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)