UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nrl4AtW6YQS0pEnDsODiEN6siQt1qvDJvjXTpl8x16g='
WHERE
key_id = '617321083c747167ce8ce6b0e0942e415c8fcf2a2ade690642dfb89027f04d4a'
AND (
token = 'nrl4AtW6YQS0pEnDsODiEN6siQt1qvDJvjXTpl8x16g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)