UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyULn9S8+39nOskB5mTta82BrCEyTuRuARCCUllyRwA=' 
WHERE 
  key_id = 'db4d99dd7f09f3e975708e01ca174363f895094ba6368778ec1b2a70e33fdea5' 
  AND (
    token = 'QyULn9S8+39nOskB5mTta82BrCEyTuRuARCCUllyRwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040