UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UCK1kqw9VPAua0cdBOsOQezQZdob+x+QwjjIB4giwQ0='
WHERE
key_id = 'bdc422941cd327c823b781be437eb74b12ffc065f85f9e9836d9aa3d100800e6'
AND (
token = 'UCK1kqw9VPAua0cdBOsOQezQZdob+x+QwjjIB4giwQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)