UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1z6JiWl3m37TwSFfI+yvEmcckhU9buRMctTDwVZVgI=' 
WHERE 
  key_id = '0090a6002b9d10aae5ec284cef836cd3382cf1ed7ff7a54f65d2e53461e67207' 
  AND (
    token = 'e1z6JiWl3m37TwSFfI+yvEmcckhU9buRMctTDwVZVgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029