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