UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jz0YLS9bbY1hbSAdn0AAMsCLrYJa+Qqk6o833NAZNSg=' 
WHERE 
  key_id = '8f3765607948b4cd65f15d53f5e0b33e17c1ebca20a8bbff8eff268f48a81d1e' 
  AND (
    token = 'jz0YLS9bbY1hbSAdn0AAMsCLrYJa+Qqk6o833NAZNSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035