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

Query time 0.00046