UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XxIY5h/KxuwLm1k8QolTPBX4agy9OVtXt+Pb4jzWaBY='
WHERE
key_id = '0c950b48cc9ddd504fca96766e9ef110af457a0494306cfcf61b012505137fe0'
AND (
token = 'XxIY5h/KxuwLm1k8QolTPBX4agy9OVtXt+Pb4jzWaBY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)