UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gPZhYHuXLH61tildnmG1F9H8ZP8+wNbtKd8uOh9zMqk=' 
WHERE 
  key_id = '707328ebd81962f31d37611336b3aa827f72cd312322a4b0ae3a9a49ffe04c0f' 
  AND (
    token = 'gPZhYHuXLH61tildnmG1F9H8ZP8+wNbtKd8uOh9zMqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022