UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8MKmMbSlPnvtRRK5UL8SQUGeYkO/FJhWQXVuPNSBc+w=' 
WHERE 
  key_id = '9bee537d9c23692529e153576c79c35ac7ae7f63de0b1c2efd6454812d02223a' 
  AND (
    token = '8MKmMbSlPnvtRRK5UL8SQUGeYkO/FJhWQXVuPNSBc+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043