UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6ANlZ0tdyBXyYG/ZC1dZ3Vq6wQ1TX8Kgv8wUMinZf8=' 
WHERE 
  key_id = '9ca09f94991300635f53933ce6865cf00870aa9a99fa7eecf1c40e96e293e28f' 
  AND (
    token = 'd6ANlZ0tdyBXyYG/ZC1dZ3Vq6wQ1TX8Kgv8wUMinZf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030