UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IqSRDAqOpCSAmQiYRk+IBkZso7GX2DUOyLqKpe/kSms=' 
WHERE 
  key_id = 'de6ed15c2dc583532472fd75599284956f417770bcb8f394548c1ad869c4159c' 
  AND (
    token = 'IqSRDAqOpCSAmQiYRk+IBkZso7GX2DUOyLqKpe/kSms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036