UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K7slEa0e83n1VWS12MICoc7S3UWrdu2Hpt78F/y+ng4='
WHERE
key_id = 'e9e9f7f584351270b2f96b5078151b2aeb959283204d04b41cc4fdfbfe1c8888'
AND (
token = 'K7slEa0e83n1VWS12MICoc7S3UWrdu2Hpt78F/y+ng4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)