UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Aw1HzgOr9x8+jdfpd1e7rdqND28E5oi+8DylBtvpikg=' 
WHERE 
  key_id = '4115d749cc3154333013f38a8c568aaf32888a71f86e72eb8da46035a57deaf6' 
  AND (
    token = 'Aw1HzgOr9x8+jdfpd1e7rdqND28E5oi+8DylBtvpikg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045