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