UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/1k8QUUaM8KV+hc5fKspR5HacYN5UCB7K57BodIpUVk='
WHERE
key_id = 'cd51a478a395ce28946a1b5f2bd06b7a031c6decaa4fbb2f8429510456b003dc'
AND (
token = '/1k8QUUaM8KV+hc5fKspR5HacYN5UCB7K57BodIpUVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)