UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tdk7BXzcobH8ezeva2hM9pCFFhKQli1ydW7UuWnvohA='
WHERE
key_id = 'c1b9447c4da7d50df408da5e7f16016451ccd1f5038f87a3498e441b25717225'
AND (
token = 'tdk7BXzcobH8ezeva2hM9pCFFhKQli1ydW7UuWnvohA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)